package weaver.interfaces.expense.action.gzc.th;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.util.ExpenseCompare;
import weaver.interfaces.util.ExpenseCompareUtil;
import weaver.interfaces.util.ExpenseInfoUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
/**
 * 
 * @ClassName: WXPLY_TH_ExpenseAction 
 * @Description: 危险品领用表预算退回
 * @author xiyufei
 * @date 2017-3-20 上午11:19:21 
 *
 */
public class WXPLY_TH_ExpenseAction  extends BaseBean{ 
	public void execute(String workflowid,String requestid ) { 
			writeLog("进入WXPLY_TH_ExpenseAction-----------"+requestid);
			RecordSet rs = new RecordSet(); 
			rs.executeSql("select formid from workflow_base where id = " + workflowid);
			rs.next();
			String formid = rs.getString("formid");
			String formtable = "formtable_main_" + formid.replaceAll("-", "");
			String iskt ="0"; 
			String ccode = "";
			double amount = 0;
			String cexpenseitemcode = "";
			String citemcode = "";
			String iyear = "";
			//System.out.println("select  id,ks,cexpenseitemcode,citemcode,zje,zjly,sqrq,kth from "+formtable+" where requestid="+requestid);
			rs.execute("select id,ks,zcxm,xm,zj,sf,sqrq,kth1 from "+formtable+" where requestid="+requestid);
			rs.next(); 
			ExpenseInfoUtil expenseInfoUtil = new ExpenseInfoUtil();
			ccode =  expenseInfoUtil.getKsbm(Util.null2String(rs.getString("ks"))); 
			amount =  Util.getDoubleValue(rs.getString("zj"),0); 
			citemcode=  Util.null2String(rs.getString("xm")); 
			cexpenseitemcode=  Util.null2String(rs.getString("zcxm"));  
			String kth =  Util.null2String(rs.getString("kth"));  
			iyear =  Util.null2String(rs.getString("sqrq")).substring(0,4); 
			String sfkt = Util.null2String(rs.getString("sf"));  
			ExpenseCompareUtil  expenseCompareUtil= new  ExpenseCompare();
			if("0".equals(sfkt)){// 课题号+项目支出
				iskt ="1";
			}
			boolean bl = expenseInfoUtil.releaseExpense(workflowid, ccode, cexpenseitemcode, citemcode, kth, amount, iyear,iskt);
  
 
	}

}
